<?php
// $Id: HrException.php 27 2010-11-16 12:49:54Z mjohnson60@gmail.com $


class HrException extends Exception
{
	protected $wrappedException = NULL;
	
	protected static $lastException = NULL;

	public static function createFromException(Exception $e)
	{
		$exception = new HrException(sprintf('Wrapped %s: %s', get_class($e), $e->getMessage()));
		$exception->setWrappedException($e);
		self::$lastException = $e;
		
		return $exception;
	}

	public static function clearLastException()
	{
		self::$lastException = NULL;
	}

	/**
	 * @return the $wrappedException
	 */
	public function getWrappedException()
	{
		return $this->wrappedException;
	}

	/**
	 * @param field_type $wrappedException
	 */
	public function setWrappedException($wrappedException)
	{
		$this->wrappedException = $wrappedException;
	}

	/**
	 * @return the $lastException
	 */
	public static function getLastException()
	{
		return HrException::$lastException;
	}

	/**
	 * @param field_type $lastException
	 */
	public static function setLastException($lastException)
	{
		HrException::$lastException = $lastException;
	}

}